import './App.css';
import React, {Component} from 'react';
import Search from "./components/Search";
import List from "./components/List";

class App extends Component {
    state = {
        users: [],//初始化用户数组
        isFirst: true, //是否为第一次打开页面
        isLoading: false, //是否处于加载中
        err: ''//存放请求相关的错误信息
    }

    //更新app的状态
    updateAppState = (stateObj) => {
        this.setState(stateObj)
    }

    render() {
        return (
            <div className="container">
                <Search updateAppState={this.updateAppState}/>
                <List {...this.state}/>
            </div>
        );
    }
}

export default App;
